package com.atguigu.yygh.host.service.impl;

import com.atguigu.yygh.common.config.YyghException;
import com.atguigu.yygh.host.mapper.HospitalSetMapper;
import com.atguigu.yygh.host.service.HospitalSetService;
import com.atguigu.yygh.model.hosp.HospitalSet;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * @author DongYu Zhou
 * @date 2022/6/16 14:47
 */
@Service
public class HospitalSetServiceImpl extends ServiceImpl<HospitalSetMapper, HospitalSet> implements HospitalSetService {
    @Override
    public String getHoscSign(String hoscode) {

        QueryWrapper<HospitalSet> wrapper = new QueryWrapper<>();
        wrapper.eq("hoscode",hoscode);

        HospitalSet hospitalSet = baseMapper.selectOne(wrapper);
        if (hospitalSet!=null){
            return hospitalSet.getSignKey();
        }{
            throw new YyghException(20001,"获取签名失败");
        }
    }
}
